package com.example.mapper;

import com.example.pojo.Ticket;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
@Mapper
public interface TicketMapper {
    @Select("select * from ticket_info;")
    public List<Ticket> selectAll();

    @Insert("insert into ticket_info (name,price,sum,db_name) values (#{name},#{price},#{sum},Database())")
    public boolean insertTicket(Ticket ticket);

    @Select("select * from ticket_info where id=#{id}")
    public Ticket getTicket(long id);

    @Delete("delete from ticket_info where id=#{id}")
    public boolean deleteTicket(long id);

    @Select("select sum from ticket_info where id=#{id}")
    public int searchById(long id);

    @Insert("insert into order_info (t_id) values (#{t_id}) ")
    void insertOrder(long id);
}
